'''
Created on Nov 3, 2012

@author: peng
'''
# from email.mime.text import MIMEText

print 'OK'

from subprocess import Popen
from subprocess import PIPE
from email.mime.text import MIMEText


def send_mail(subject, body, toaddrs):
    msg = MIMEText(body, 'html')
    msg['Subject'] = subject
    msg["From"] = "prong@bainainfo.com"
    msg["To"] = ','.join(toaddrs)
    p = Popen(["/usr/sbin/sendmail", "-t"], stdin=PIPE)
    p.communicate(msg.as_string())


send_mail('teswt', 'test', 'prong@bainainfo.com')
